<template>
  <div class="cell-btn xh-list">
    <search :auto-fixed="false"  v-model="searchText" @on-submit="getResult" placeholder="请输入项目名称／状态查找" ></search>
    <group  v-for="(item,index) in getResult" :key="index" class="group-main">
      <cell :link="{path:'/demos/my-invite-bid-detail',
      query:{CgPlanGUID:item.CgPlanGUID,InviteBidGUID:item.InviteBidGUID,
      InviteBidForenoticeGUID:item.InviteBidForenoticeGUID}}">
            <div slot="title" class="list-cell-tilte cell-desc">
              <div class="list-cell-tilte-left">
                 {{item.ForenoticeTitle}}
              </div>
              <div class="list-cell-tilte-right">
                  <div class="list-cell-tilte-right-head">
                    {{item.Status}}
                  </div>
                  <div class="list-cell-tilte-right-foot">
                     {{item.ProcessDate|formatDate('YYYY-MM-DD')}}
                  </div>
              </div>
            </div>
          
      </cell>
    </group>
    
  </div>
</template>

<script>
import { Search, Tab, TabItem, Group, Cell, XButton } from 'vux'
import {MyInviteBidService} from '../../service/Services.js'
import _ from 'lodash'

export default {
  name: 'CellBtn',
  components: {
    Search,
    Tab,
    TabItem,
    Group,
    Cell,
    XButton
  },
  data () {
    return {
      searchText: '',
      pageData: {}
    }
  },
  methods: {
    loadData () {
      this.$vux.loading.show({
        text: '加载中...'
      })
      var providerGUID = this.$store.getters.getUserInfo.ProviderGUID
      MyInviteBidService.getMyInviteBid(providerGUID).then((res) => {
        this.$vux.loading.hide()
        this.pageData = res.Data
      }).catch((res) => {
        this.$vux.toast.show({
          text: '请求失败,请联系管理员',
          type: 'cancel',
          width: '180px'
        })
        console.log(res)
      })
    }

  },
  computed: {
    getResult () {
      return _.filter(this.pageData, item => {
        return item.ForenoticeTitle.indexOf(this.searchText) !== -1 ||
        item.Status.indexOf(this.searchText) !== -1
      })
    }
  },
  created () {
    this.loadData()
  }
}
</script>
<style scoped lang="less">
@import '../../assets/less/list.less';
.list-cell-tilte-left{
  width: 75%;
  float:left;
  white-space:normal;
}
.list-cell-tilte-right{
  float:right;
  .list-cell-tilte-right-head{
    text-align: center;
    border: 1px solid #DC220B;
    border-radius: 12px;
    font-family: PingFangSC-Regular;
    font-size: 13px;
    color: #DC220B;
  }
  .list-cell-tilte-right-foot{
    margin-top:5px;
    font-family: PingFangSC-Regular;
    font-size: 12px;
    color: #888888;
  }
}
</style>
